//
//  Target_Alter.m
//  SleepingElf
//
//  Created by karong on 2023/6/21.
//

#import "Target_Alter.h"
#import "BaseAlterController.h"
#import "SETextFieldAlterController.h"

@implementation Target_Alter

- (id)Action_showAlter:(NSDictionary *)params {
    BaseAlterController * targetVC = (BaseAlterController *)[self instantiateViewControllerWithName:@"BaseAlterController"];
    if ([params.allKeys containsObject:@"titleStr"])targetVC.titleStr = params[@"titleStr"];
    if ([params.allKeys containsObject:@"content"])targetVC.contentStr = params[@"content"];
    if ([params.allKeys containsObject:@"confirm"])targetVC.confirmStr = params[@"confirm"];
    if ([params.allKeys containsObject:@"cancel"])targetVC.cancelStr = params[@"cancel"];
    targetVC.confirmHandle = params[@"confirmHandle"];
    return targetVC;
}

- (id)Action_showTextFieldAlter:(NSDictionary *)params {
    SETextFieldAlterController * targetVC = (SETextFieldAlterController *)[self instantiateViewControllerWithName:@"SETextFieldAlterController"];
    if ([params.allKeys containsObject:@"titleStr"])targetVC.titleStr = params[@"titleStr"];
    if ([params.allKeys containsObject:@"content"])targetVC.contentStr = params[@"content"];
    if ([params.allKeys containsObject:@"confirm"])targetVC.confirmStr = params[@"confirm"];
    if ([params.allKeys containsObject:@"cancel"])targetVC.cancelStr = params[@"cancel"];
    targetVC.maxWordCount = [params[@"maxWordCount"] integerValue];
    targetVC.confirmHandle = params[@"confirmHandle"];
    targetVC.placeholderStr = params[@"placeholderStr"];
    return targetVC;
}

- (UIViewController *)instantiateViewControllerWithName:(NSString *)name {
   return [[UIStoryboard storyboardWithName:name bundle:nil] instantiateViewControllerWithIdentifier:name];
}
@end
